package com.binarysoft.service.user;

import java.util.Collection;


import common.framework.dsb.DynamicService;

public interface UserService extends DynamicService {
	String LOCALE_ZH = "ZH";
	String LOCALE_EN = "EN";

	/**
	 * 获取所有用户信息
	 * 
	 * @return
	 * @throws Exception
	 */
	Collection<UserInfo> getAllUsers() throws Exception;

	/**
	 * 分页获取用户
	 * 
	 * @param page
	 *            页码(从第1页开始)
	 * @param pagesize
	 *            每页的条目数
	 * @return
	 * @throws Exception
	 */
	Collection<UserInfo> getAllUsers(int page, int pagesize) throws Exception;

	/**
	 * Get all roles.
	 * 
	 * @return
	 * @throws Exception
	 */
	Collection<UserRole> getAllRoles() throws Exception;

	/**
	 * 根据ID 获取用户信息
	 * 
	 * @param id
	 * @return
	 * @throws Exception
	 */
	UserInfo getUserByID(long id) throws Exception;

	/**
	 * 根据登录ID获取用户信息
	 * 
	 * @param loginID
	 * @return
	 * @throws Exception
	 */
	UserInfo geUserByLoginID(String loginID) throws Exception;

	/**
	 * 创建用户
	 * 
	 * @param user
	 * @return
	 * @throws Exception
	 */
	long createUser(UserInfo user) throws Exception;

	/**
	 * 删除用户
	 * 
	 * @param id
	 * @return
	 * @throws Exception
	 */
	void deleteUser(long id) throws Exception;

	/**
	 * 更改用户删除状态
	 * 
	 * @param deleted
	 *            状态
	 * @throws Exception
	 */
	void setUserDeletedStatus(long id, boolean deleted) throws Exception;

	/**
	 * 更改用户状态
	 * 
	 * @param active
	 * @throws Exception
	 */
	void setUserStatus(long id, boolean active) throws Exception;

	/**
	 * 更新用户信息
	 * 
	 * @param id
	 * @param user
	 * @return
	 * @throws Exception
	 */
	void updateUser(long id, UserInfo user) throws Exception;

	/**
	 * 修改密码
	 * 
	 * @param id
	 * @param oldpass
	 * @param newpass
	 * @return 影响行数
	 * @throws Exception
	 */
	boolean changePass(long id, String oldpass, String newpass) throws Exception;

	/**
	 * 重置密码
	 * 
	 * @param id
	 * @throws Exception
	 */
	void resetPass(long id, String newpass) throws Exception;

	/**
	 * 根据ID 获取角色信息
	 * 
	 * @param id
	 *            角色ID
	 * @return 角色信息
	 * @throws Exception
	 */
	UserRole getRoleByID(String id) throws Exception;

	/**
	 * 创建角色
	 * 
	 * @param role
	 *            角色信息
	 * @return 角色ID
	 * @throws Exception
	 */
	void createRole(UserRole role) throws Exception;

	/**
	 * 删除角色
	 * 
	 * @param id
	 *            角色ID
	 * @return
	 * @throws Exception
	 */
	void deleteRole(String id) throws Exception;

	/**
	 * 更新角色信息
	 * 
	 * @param id
	 *            角色ID
	 * @param role
	 *            角色信息
	 * @return
	 * @throws Exception
	 */
	void updateRole(String id, UserRole role) throws Exception;

}
